package me.yxy.mobanddd.exception;

public class BusinessException extends RuntimeException {

    private String businessMsg = "";


    public BusinessException(String msg){
        super(msg);

        //业务异常，只需要一行堆栈信息，用来定位异常代码行即可
        StackTraceElement[] stacks = this.getStackTrace();
        StackTraceElement[] newStacks = new StackTraceElement[1];
        newStacks[0] = stacks[0];
        this.setStackTrace(newStacks);

        businessMsg = msg;
    }

    public BusinessException(String msg,String businessMsg){
        this(msg);
        this.businessMsg = businessMsg;
    }
}
